package net.vkits.api;

import net.vkits.anjiamiao.domain.model.Banner;
import net.vkits.anjiamiao.domain.repository.BannerRepository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by ethan-liu on 2017/1/6.
 */
@Controller
public class BannersApiController implements BannersApi {

    @Resource
    private BannerRepository bannerRepository;

    @Override
    public ResponseEntity<List<Banner>> bannersGet() {
        List<Banner> bannerList = bannerRepository.findAll();
        return new ResponseEntity<>(bannerList, HttpStatus.OK);
    }
}
